package com.qiankunxu;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author : Hunter Huang
 * @since : 2023/12/13 20:42
 * {@literal : do the testing}
 */
@SpringBootApplication
public class App {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(App.class, args);
//        String applicationName = context.getEnvironment().getProperty("applicationName");
//        System.out.println("applicationName:" + applicationName);

        //AnnotationConfigServletWebServerApplicationContext 最终得到的容器的类型
        /*System.out.println(context.getBean(App.class).getClass());
        System.out.println(context.getClass());*/

        //获取BeanDefinition对象
/*        ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        BeanDefinition userBdf = beanFactory.getBeanDefinition("user");
        BeanDefinition aaBdf = beanFactory.getBeanDefinition("aa");
        System.out.println(userBdf.getClass()); //ScannedGenericBeanDefinition
        System.out.println(aaBdf.getClass());//ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition
   */
        System.out.println(context.getBean("teacher"));
    }
}
